// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: leon

#include "coin2/exchange/bitstamp/symbology/currency.h"

#include <gtest/gtest.h>

TEST(BitstampCurrency, constructor) {
  using namespace coin2::exchange::bitstamp::symbology;
  using coin2::exchange::base::market::ExchangeType;
  using coin2::exchange::base::market::MarketType;

  int64_t resolve_ts = 1572502253 * 1e9;

  BitstampCurrency usd("USD");
  EXPECT_EQ(usd.currency(), "USD");
  EXPECT_EQ(usd.native_currency(MarketType::Spot), "usd");
  EXPECT_EQ(usd.rep_currency(), "USD");
  EXPECT_EQ(usd.exchange(), ExchangeType::Bitstamp);

  auto btc1 = BitstampCurrency::FromStr("BTC", resolve_ts);
  EXPECT_EQ(btc1.currency(), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Spot), "btc");
  EXPECT_EQ(btc1.exchange(), ExchangeType::Bitstamp);

  auto btc2 = BitstampCurrency::FromNativeStr("btc", resolve_ts);
  auto btc3 = BitstampCurrency::FromNormStr("BTC", resolve_ts);
  auto btc4 = BitstampCurrency::FromStr("BTC", resolve_ts);
  EXPECT_EQ(btc2, btc1);
  EXPECT_EQ(btc3, btc1);
  EXPECT_EQ(btc4, btc1);

  auto bch = BitstampCurrency::FromStr("BCH", resolve_ts);
  EXPECT_EQ(bch.currency(), "BCHABC");
  EXPECT_EQ(bch.native_currency(MarketType::Spot), "bch");
}
